{extend name="common:main" /}
{block name="cssjs"}
{/block}
{block name="content"}
<div class="box box-default">
	<div class="box-body">
		{if condition="empty($logList)"}
		无日志
		{else /}
		<ul id="log_list">
			{foreach name="logList" item="logs" key="path"}
			<li>
				<label>{$path}</label>
				<ul class="row">
					{foreach name="logs" item="log"}
					<li class="col-sm-4"><a href="javascript:;" data-file="{$log['file']}">{$log['name']}</a></li>
					{/foreach}
				</ul>
			</li>
			{/foreach}
		</ul>
		{/if}
	</div>
</div>

<script type="text/javascript">
'use strict';
$('#log_list a[data-file]').bind('click',function(){
	var file=$(this).attr('data-file');
	var url=ulink('Tool/log?file=_file_',{_file_:file});
	var uploadTxt='上报日志';
	windowIframe('日志：'+file+' <button type="button" id="upload_log" class="btn btn-sm btn-default" style="padding:3px 5px;">'+uploadTxt+'</button>',url,{lg:1});
	$('#upload_log').bind('click',function(){
		$(this).text(uploadTxt+'...');
		$(this).attr('disabled',true);
		ajaxOpen({
			type: 'post',
			dataType: 'json',
			url:ulink('Tool/log?upload=1&file=_file_',{_file_:file}),
			success: function (data) {
				$('#upload_log').text(uploadTxt);
				$('#upload_log').attr('disabled',false);
				ajaxDataMsg(data);
			}
		});
	});
});
</script>
{/block}